package com.hunttown.mes.rpc.domain.enums.iot.tasks;

import java.util.HashMap;
import java.util.Map;

/**
 * 任务类型
 * created by wangjunfu on 2019/08/19
 */
public enum TaskTypeEnum {
    DAYBILL(1, "电表日帐单"),
    MONTHBILL(2, "电表月帐单"),
    TEMPERATURE(3, "温湿度传感器"),
    MANTUN(4, "曼顿空开定时"),
    MANTUNHEART(5, "曼顿空开心跳"),
    HUANGBANGMETER(6, "华邦电表心跳"),
    MANTUNHOUR(7, "曼顿设备【时】报表"),
    MANTUNDAY(8, "曼顿设备【日】报表"),
    MANTUNMONTH(9, "曼顿空开【月】报表"),
    MANTUNALARM(10, "曼顿设备报警信息");

    private final int key;
    private final String value;

    TaskTypeEnum(int key, String value) {
        this.key = key;
        this.value = value;
    }

    // 根据key获取枚举
    public static String getEnumByKey(int key) {
        String value = "";

        for (TaskTypeEnum temp : TaskTypeEnum.values()) {
            if (temp.getKey() == key) {
                value = temp.getValue();
            }
        }

        return value;
    }

    // 将枚举组成Map
    public static Map<Integer, String> getEnumList() {
        Map<Integer, String> map = new HashMap<>();

        for (TaskTypeEnum temp : TaskTypeEnum.values()) {
            map.put(temp.getKey(), temp.getValue());
        }

        return map;
    }

    public int getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }
}
